package com.douyuehan.doubao.wechatpay.jparepository;

import com.douyuehan.doubao.wechatpay.model.entity.ParkingPayment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface ParkingPaymentRepository extends JpaRepository<ParkingPayment, Integer> {

    ParkingPayment findByOutTradeNo(String outTradeNo);

    @Query(value = "select * from parking_payment where order_payment_ids like ?1", nativeQuery = true)
    ParkingPayment findByOrderPaymentIds(String orderPaymentId);

    @Query(value = "select count(1) from ParkingPayment where siteId = ?1 and projectId = ?2 and payResult is not null ")
    int findCountBySiteIdAndProjectId(int siteId, int projectId);
}
